#ifndef SUMCOL_H_INCLUDED
#define SUMCOL_H_INCLUDED
#include "Matrix.h"

Matrix sumrow(Matrix a)
{

    int N=a.getRow();
    Matrix b(1,N);
    for(int i=1;i<N+1;i++)
    {
        b(1,i)=0;
        for(int j=1;j<N+1;++j)
        {
            b(1,i)=b(1,i)+a(i,j);
        }
    }
    return b;
}

Matrix sumcol(Matrix a)
{
    int N=a.getCol();
    Matrix b(1,N);
    for(int i=1;i<N+1;i++)
    {
        b(1,i)=0;
        for(int j=1;j<N+1;++j)
        {
            b(1,i)=b(1,i)+a(j,i);
        }
    }
    return b;
}

double sumOnecol(Matrix a, int l)
{
    int i=0;
    double s=0;
    for(i=0;i<a.getRow();++i)
    {
        s+=a(i+1,l);
    }
    return s;
}
double sumOnerow(Matrix a, int l)
{
    int i=0;
    double s=0;
    for(i=0;i<a.getCol();++i)
    {
        s+=a(l,i+1);
    }
    return s;
}

#endif // SUMCOL_H_INCLUDED
